import os


# 统计文件夹中图片数量
def count_images_in_folder(folder_path):
    image_extensions = {".jpg"}#, ".jpeg", ".png", ".bmp", ".gif", ".tiff", ".webp"}
    image_count = 0
    for root, dirs, files in os.walk(folder_path):
        for file in files:
            _, ext = os.path.splitext(file)
            if ext.lower() in image_extensions:
                image_count += 1

    return image_count

# 示例用法
if __name__ == "__main__":
    folder_path = "/home/xian/mzs/mzs_code/Dataset/ETH/result/all_landmark"
    image_count = count_images_in_folder(folder_path)
    print(f"在文件夹 '{folder_path}' 中找到 {image_count} 张图片。")